<template>
	<el-dialog :title="dialogTitle" :visible.sync="visible" top="0" width="560px" append-to-body>
		<el-form v-bind="formConfig" :model="formData" :rules="formRules" label-width="80px" v-loading="loading">
			<el-row :gutter="16">
				<el-col :span="24">
					<el-form-item label="题库名称" prop="name">
						<el-input v-model="formData.name" placeholder="请输入题库名称"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="题库状态" prop="status">
						<el-radio-group v-model="formData.status" v-removeAriaHidden:radio>
							<el-radio label="1">正常</el-radio>
							<el-radio label="2">禁用</el-radio>
						</el-radio-group>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="访问权限" prop="permission">
						<el-select v-model="formData.permission" placeholder="请选择访问权限">
							<el-option label="完全私有" value="1"></el-option>
							<el-option label="只读共享" value="2"></el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="题库说明">
						<el-input type="textarea" v-model="formData.des"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
		</el-form>
		<template slot="footer">
			<el-button size="medium" @click="visible = false">取消</el-button>
			<el-button size="medium" type="primary" :loading="btnLoading" @click="handleSubmitForm()">{{ formTypeName }}</el-button>
		</template>
	</el-dialog>
</template>

<script>
import formMixins from '@/mixins/formMixins';
import { queryTopicLibrary, addedTopicLibrary, updateTopicLibrary } from '@/api/exam/testQuestionBank';
export default {
	mixins: [formMixins],
	data() {
		return {
			formName: '题库',
			formRules: {
				name: [{ required: true, message: '请输入题库名称', trigger: 'blur' }],
				status: [{ required: true, message: '请选择题库状态', trigger: 'change' }],
				permission: [{ required: true, message: '请选择访问权限', trigger: 'change' }]
			}
		};
	},
	computed: {
		detailData() {
			return eval(queryTopicLibrary);
		},
		callFunction() {
			return eval(this.addOrEdit ? addedTopicLibrary : updateTopicLibrary);
		}
	},
	methods: {}
};
</script>
